package com.glsc.ngateway.common.base.domain.mysql.gateway.system;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

@Entity
@Data
@Table(name = "t_gw_system_vendor_info")
@org.hibernate.annotations.Table(appliesTo = "t_gw_system_vendor_info",comment = "供应商基础信息表")
public class SystemVendorInfo implements Serializable {

    @ApiModelProperty(value = "主键")
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", columnDefinition = "int comment '主键'")
    private Integer id;

    @ApiModelProperty(value = "供应商编码")
    @Column(name = "vendor_code", columnDefinition = "varchar(100) comment '供应商编码GL+VENDOR+1001'")
    private String vendorCode;

    @ApiModelProperty(value = "供应商联系人姓名")
    @Transient
    private List<String> vendorContractName;

    @ApiModelProperty(value = "供应商联系人id")
    @Transient
    private List<Integer> vendorContractId;

    @ApiModelProperty(value = "供应商联系人")
    @Transient
    private List<GwContact> vendorContract;

    @ApiModelProperty(value = "供应商名称")
    @Column(name = "vendor_name", columnDefinition = "varchar(200) comment '供应商名称'")
    private String vendorName;

    @ApiModelProperty(value = "供应商联系方式")
    @Column(name = "vendor_contact_information", columnDefinition = "varchar(200) comment '供应商联系方式'")
    private String vendorContactInformation;

    @ApiModelProperty(value = "供应商手机号")
    @Column(name = "vendor_mobile", columnDefinition = "varchar(200) comment '供应商手机号'")
    private String vendorMobile;

    @ApiModelProperty(value = "供应商简介")
    @Column(name = "brief_intro", columnDefinition = "text comment '供应商简介'")
    private String briefIntro;

    @ApiModelProperty(value = "供应商地址")
    @Column(name = "address", columnDefinition = "varchar(200) comment '供应商地址'")
    private String address;

    @ApiModelProperty(value = "信息描述")
    @Column(name = "service_info", columnDefinition = "text comment '服务信息描述'")
    private String serviceInfo;

    @ApiModelProperty(value = "删除状态")
    @Column(name = "deleted", columnDefinition = "int(1) comment '删除状态'")
    private Integer deleted;

    @Column(name = "insert_time", columnDefinition = "datetime comment '创建时间'")
    @org.hibernate.annotations.CreationTimestamp
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    protected LocalDateTime insertTime;

    @Column(name = "update_time", columnDefinition = "datetime comment '更新时间'")
    @org.hibernate.annotations.UpdateTimestamp
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    protected LocalDateTime updateTime;
}
